package com.team.olympic.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;

import com.team.olympic.dto.UserVoteDto;
import com.team.olympic.pojo.User;


public interface UserMapper {
    List<User> findAllUsers();
    User findUserByPhone(String phone);
    User findUserById(Long id);
    void insertUser(User user);
    @Insert({"insert into match_user(match_id, user_id, is_win) values(#{matchId}, #{userId}, #{win})"})
    void insertUserVote(UserVoteDto userVote);
    @Update({"update user set score = score + 1 where id = #{id}"})
    void increUserScoreById(Long id);
    @Update({"update user set score = score - #{score} where id = #{id}"})
    void declineUserScoreById(Long id, Long score);
    void deleteUserById(Long id);
    @Update({"update user set status = 0 where id = #{id}"})
    void freeUserById(Long id);
    @Update({"update user set status = 1 where id = #{id}"})
    void blockUserById(Long id);
    @Update({"update user set name = #{name}, address = #{address} where id = #{id}"})
    void updateUser(User user);
}
